<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport"
        content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <link rel="stylesheet" href="<?php echo base_url().'public/home/' ?>css/general.css">
    <link rel="stylesheet" href="<?php echo base_url().'public/home/' ?>css/feedback.css">
    <script src="<?php echo base_url().'public/home/' ?>js/jquery-2.0.3.min.js"></script>
    <title>信息反馈统计报表</title>
</head>

<body>

<div class="min">

<input type="hidden" name="url" id="url"value="<?php echo base_url() ?>">

</div>

<div class="botn">
        
</div>

<div class="loading" style="text-align:center;"><img src="<?php echo base_url().'public/home/' ?>images/loading1.gif"></div>

<div class="tip" style="display: none;text-align:center;color: #5d5d5d;height: 30px;">到底了,没有数据了~</div>


<script>
    
    let pageNo='1';
    let pageSize='20'
    let have=true;
    let total = 0;
    $(function () {

        console.log(pageNo);
        console.log(pageSize);
        getList();
        //分页
        $(window).scroll(function(){
            // scroll at bottom
            if ($(window).scrollTop() + $(window).height() == $(document).height()) {
                pageNo++;
                getList()
            }
        });
    })
    function getList(){
        if(have){
            $.ajax({
                url: $("#url").val()+"/Home/Attend/informationFeedback",
                dataType:"json",
                type: "post",
                data: {
                    pageNo:pageNo,
                    pageSize:pageSize
                },
                success: function (data) {
                    let t = JSON.parse(data.v);
                    console.log(t);
                    let html = '';
                    total += t.all_count;


                    // 总计反馈 数据累加
                     html +=`<div class="bot">
                             <span>总计反馈：</span><span>${total}</span></div>
                             `
                             $('.botn').append(html);
                    
                    $.each(t.ret, function (k, v) {
                        let a = (pageNo-1)*pageSize+(k+1) + '.' ;

                        html+=`<div class="fk">
                        <div class="name" style="margin-left: 5%;margin-right: 5%;font-size:18px">
                            <p id="xh" style="display: inline;">${a}</p>
                            <p class="sz" style="display: inline;">${v.username}</p>
                            <p class="tt" id="name">${v.dept_name}</p>
                            <span class="spd" style="color:blue;cursor:pointer;float:right;font-size: 18px;">累计
                            <p id="time" style="display: inline;">${v.count}</p>次反馈</span>
                            </div>
                        </div>`
                        // 判断是否还有数据
                        if( pageNo==t.totalPage){
                            have=false
                            $(".loading").hide();
                            $(".tip").show();
                        }
      
                    });
                    $('.min').append(html);

                },
            });
        }
    }


    </script>
</body>

</html>